/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.ez2find.manager;

import com.ez2find.model.Backup;
import java.util.List;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

/**
 *
 * @author org.@le
 */
@Stateless
public class BackupManagerBean implements BackupManagerLocal {
 
    @PersistenceContext
    private EntityManager em;

    public void create(Backup backup) throws Exception {
        em.persist(backup);
    }

    public void update(Backup backup) throws Exception {
        em.merge(backup);
    }

    public void delete(Backup backup) throws Exception {
        em.remove(backup);
    }

    public Backup find(long id) {
        return em.find(Backup.class, id);
    }

    public List<Backup> listAll() {
        return em.createQuery("select c from Backup c").getResultList();

    }

 
}
